<template>
  <div>
    <!-- <h3 class="title">大首页</h3> -->
    <!-- 二级路由出口 -->
    <!-- <transition enter-active-class="animate__animated animate__fadeIn"> -->
    <router-view class="main" style="padding-bottom:500px"></router-view>
    <!-- </transition> -->
    <!-- 底部导航 -->
    <!-- 点击底部导航跳到对应的页面 -->
    <!-- 固定类类名active-class
    
    或者在元素上赋值一个类名-->
    <!--底部导航 + 图片 -->
    <!-- <footer>
      <router-link class="center" active-class="active" v-for="item in imgArr" :key="item.path" :to="item.path" >
        <img :src="item.select_img" v-if="$route.path == item.path" alt="">
        <img :src="item.no_select_img" v-else alt="">
        <div class="text">{{item.text}}</div>
      </router-link>
    </footer>-->
    <!-- 封装footer  -->
    <tab-bar :imgArr="imgArr"></tab-bar>
  </div>
</template>

<script>
import home_select from "../../assets/img/home_select.png";
import home_noselect from "../../assets/img/home_noselect.png";
import cate_select from "../../assets/img/cate_select.jpeg";
import cate_noselect from "../../assets/img/cate_noselect.png";
import shop_select from "../../assets/img/shop_select.png";
import shop_noselect from "../../assets/img/shop_noselect.png";
import mine_select from "../../assets/img/mine_select.jpeg";
import mine_noselect from "../../assets/img/mine_noselect.png";
export default {
  data() {
    return {
      imgArr: [
        {
          path: "/index/home",
          select_img: home_select,
          no_select_img: home_noselect,
          text: "首页"
        },
        {
          path: "/index/cate",
          select_img: cate_select,
          no_select_img: cate_noselect,
          text: "分类"
        },
        {
          path: "/index/shop",
          select_img: shop_select,
          no_select_img: shop_noselect,
          text: "购物车"
        },
        {
          path: "/index/mine",
          select_img: mine_select,
          no_select_img: mine_noselect,
          text: "我的"
        }
      ]
    };
  }
};
</script>

<style scoped>
footer {
  width: 100vw;
  display: flex;
  position: fixed;
  left: 0;
  bottom: 0;
  height: 0.9rem;
  background-color: #fff;
  text-align: center;
  line-height: 0.8rem;
  border-top: 0.01rem solid #666;
}
footer a {
  flex: 1;
  text-align: center;
  color: #000;
}
.active {
  color: #ff4400;
}

.center {
  text-align: center;
}
footer a img {
  width: 0.35rem;
  height: 0.35rem;
  margin-top: 5px;
}

footer a .text {
  line-height: 30px;
  margin-top: -20px;
}
.main{
  /* margin-top: 1.6rem; */
  margin-bottom: 2rem;
}
</style>